package com.zunipe.minix;

import com.zunipe.ZunipeTools;
import com.zunipe.screen.ChangeNameScreen;
import com.zunipe.until.Util;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.TitleScreen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.io.FileNotFoundException;

@Mixin(TitleScreen.class)
public abstract class TitleScreenMixin extends Screen
{
    protected TitleScreenMixin(Text title)
    {
        super(title);
    }

    @Inject(method = "init", at = @At("RETURN"))
    protected void init(CallbackInfo info)
    {
        if (!ZunipeTools.PASS)
            return;
        this.addDrawableChild(new ButtonWidget(0, 0, 98, 20, new LiteralText("修改ID"), (button) ->
                this.client.setScreen(new ChangeNameScreen(this))));
        Util.autoAttack = false;
        Util.autoDrop = false;
        Util.autoSignIn = false;
        Util.autoClickRight = false;
        Util.autoClickLeft = false;
        Util.alwaysBackwardWalk = false;
        Util.scanningBox = false;
        Util.xrayOn = false;
        Util.firstLogin = true;
    }
}
